<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页 - 权限管理系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #667eea;
            --secondary-color: #764ba2;
            --success-color: #10b981;
            --warning-color: #f59e0b;
            --info-color: #3b82f6;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8fafc;
        }

        .sidebar {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            height: 100vh;
            position: fixed;
            width: 280px;
            box-shadow: 5px 0 15px rgba(0,0,0,0.1);
            z-index: 1000;
        }

        .main-content {
            margin-left: 280px;
            padding: 30px;
            min-height: 100vh;
        }

        .nav-link {
            color: rgba(255,255,255,0.9) !important;
            padding: 15px 25px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            transition: all 0.3s ease;
            font-weight: 500;
        }

        .nav-link:hover {
            background: rgba(255,255,255,0.15);
            padding-left: 30px;
            color: white !important;
        }

        .nav-link.active {
            background: rgba(255,255,255,0.2);
            border-left: 4px solid white;
            color: white !important;
        }

        .stat-card {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.08);
            border: none;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .stat-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        }

        .stat-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0,0,0,0.15);
        }

        .stat-number {
            font-size: 2.8rem;
            font-weight: 700;
            margin: 15px 0;
        }

        .welcome-section {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            padding: 50px 40px;
            border-radius: 20px;
            margin-bottom: 40px;
            position: relative;
            overflow: hidden;
        }

        .welcome-section::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -20%;
            width: 300px;
            height: 300px;
            background: rgba(255,255,255,0.1);
            border-radius: 50%;
        }

        .welcome-section::after {
            content: '';
            position: absolute;
            bottom: -30%;
            left: -10%;
            width: 200px;
            height: 200px;
            background: rgba(255,255,255,0.05);
            border-radius: 50%;
        }

        .icon-wrapper {
            width: 70px;
            height: 70px;
            border-radius: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 20px;
            font-size: 1.8rem;
        }

        .bg-primary-light { background: rgba(102, 126, 234, 0.1); color: var(--primary-color); }
        .bg-success-light { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
        .bg-warning-light { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }

        .system-status {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.08);
        }

        .status-item {
            display: flex;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid #f1f5f9;
        }

        .status-item:last-child {
            border-bottom: none;
        }

        .status-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            margin-right: 15px;
        }

        .dot-success { background-color: var(--success-color); }
        .dot-warning { background-color: var(--warning-color); }
        .dot-info { background-color: var(--info-color); }
    </style>
</head>
<body>
<!-- 侧边栏 -->
<div class="sidebar">
    <div class="p-4">
        <div class="d-flex align-items-center mb-3">
            <div class="icon-wrapper bg-white me-3">
                <i class="fas fa-shield-alt text-primary"></i>
            </div>
            <div>
                <h4 class="mb-0">权限管理系统</h4>
                <small class="opacity-75">专业安全解决方案</small>
            </div>
        </div>
        <p class="mb-0 text-light opacity-75">
            <i class="fas fa-user me-2"></i>欢迎，<span th:text="${currentUser.name}"></span>
        </p>
    </div>
    <nav class="nav flex-column">
        <a class="nav-link active" href="/dashboard">
            <i class="fas fa-home me-3"></i>系统首页
        </a>
        <a class="nav-link" href="/user/management">
            <i class="fas fa-users me-3"></i>用户管理
        </a>
        <a class="nav-link" href="/role/management">
            <i class="fas fa-user-shield me-3"></i>权限管理
        </a>
        <a class="nav-link" href="/user/profile">
            <i class="fas fa-user-cog me-3"></i>个人信息
        </a>
        <a class="nav-link" href="/logout">
            <i class="fas fa-sign-out-alt me-3"></i>退出登录
        </a>
    </nav>
</div>

<!-- 主内容区 -->
<div class="main-content">
    <!-- 欢迎区域 -->
    <div class="welcome-section position-relative">
        <div class="position-relative z-1">
            <h2 class="mb-3">欢迎回来，<span th:text="${currentUser.name}"></span>！</h2>
            <p class="mb-0 opacity-90">今天也是高效工作的一天，权限管理系统为您保驾护航</p>
        </div>
    </div>

    <!-- 统计卡片 -->
    <div class="row mb-5">
        <div class="col-md-4">
            <div class="stat-card">
                <div class="icon-wrapper bg-primary-light">
                    <i class="fas fa-users"></i>
                </div>
                <h3 class="stat-number text-primary" th:text="${userCount}">0</h3>
                <p class="text-muted mb-0">系统用户总数</p>
            </div>
        </div>
        <div class="col-md-4">
            <div class="stat-card">
                <div class="icon-wrapper bg-success-light">
                    <i class="fas fa-user-shield"></i>
                </div>
                <h3 class="stat-number text-success">7</h3>
                <p class="text-muted mb-0">系统角色数量</p>
            </div>
        </div>
        <div class="col-md-4">
            <div class="stat-card">
                <div class="icon-wrapper bg-warning-light">
                    <i class="fas fa-list-alt"></i>
                </div>
                <h3 class="stat-number text-warning">18</h3>
                <p class="text-muted mb-0">菜单权限数量</p>
            </div>
        </div>
    </div>

    <div class="row">
        <!-- 系统状态 -->
        <div class="col-md-6">
            <div class="system-status">
                <h5 class="mb-4">
                    <i class="fas fa-chart-line me-2 text-primary"></i>系统状态
                </h5>
                <div class="status-item">
                    <div class="status-dot dot-success"></div>
                    <div class="flex-grow-1">
                        <strong>用户认证服务</strong>
                        <div class="text-muted small">正常运行中</div>
                    </div>
                    <span class="badge bg-success">正常</span>
                </div>
                <div class="status-item">
                    <div class="status-dot dot-success"></div>
                    <div class="flex-grow-1">
                        <strong>权限管理服务</strong>
                        <div class="text-muted small">所有功能可用</div>
                    </div>
                    <span class="badge bg-success">正常</span>
                </div>
                <div class="status-item">
                    <div class="status-dot dot-success"></div>
                    <div class="flex-grow-1">
                        <strong>数据库连接</strong>
                        <div class="text-muted small">连接稳定</div>
                    </div>
                    <span class="badge bg-success">正常</span>
                </div>
                <div class="status-item">
                    <div class="status-dot dot-info"></div>
                    <div class="flex-grow-1">
                        <strong>系统性能</strong>
                        <div class="text-muted small">运行流畅</div>
                    </div>
                    <span class="badge bg-info">优良</span>
                </div>
            </div>
        </div>

        <!-- 快速操作 -->
        <div class="col-md-6">
            <div class="system-status">
                <h5 class="mb-4">
                    <i class="fas fa-bolt me-2 text-warning"></i>快速操作
                </h5>
                <div class="row g-3">
                    <div class="col-6">
                        <a href="/user/management" class="btn btn-outline-primary w-100 h-100 p-3">
                            <i class="fas fa-users fa-2x mb-2"></i>
                            <div>用户管理</div>
                        </a>
                    </div>
                    <div class="col-6">
                        <a href="/role/management" class="btn btn-outline-success w-100 h-100 p-3">
                            <i class="fas fa-user-shield fa-2x mb-2"></i>
                            <div>权限管理</div>
                        </a>
                    </div>
                    <div class="col-6">
                        <a href="/user/profile" class="btn btn-outline-info w-100 h-100 p-3">
                            <i class="fas fa-user-cog fa-2x mb-2"></i>
                            <div>个人信息</div>
                        </a>
                    </div>
                    <div class="col-6">
                        <a href="#" class="btn btn-outline-warning w-100 h-100 p-3">
                            <i class="fas fa-cog fa-2x mb-2"></i>
                            <div>系统设置</div>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>